x86/pv-shim: correctly ignore empty onlining requests
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Fri, 28 Oct 2022 13:47:59 +0000 (15:47 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 28 Oct 2022 13:47:59 +0000 (15:47 +0200)
Mem-op requests may have zero extents. Such requests need treating as
no-ops. pv_shim_online_memory(), however, would have tried to take 2³²-1
order-sized pages from its balloon list (to then populate them),
typically ending when the entire set of ballooned pages of this order
was consumed.

Note that pv_shim_offline_memory() does not have such an issue.

Fixes: b2245acc60c3 ("xen/pvshim: memory hotplug")
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
xen/arch/x86/pv/shim.c

index 49ce4f93f26249662eeb2d59cdb167c51f282c31..ae1a0e6e65af04715b27fe55a5c316d74923ddb8 100644 (file)
@@ -944,6 +944,9 @@ void pv_shim_online_memory(unsigned int nr, unsigned int order)
     struct page_info *page, *tmp;
     PAGE_LIST_HEAD(list);
 
+    if ( !nr )
+        return;
+
     spin_lock(&balloon_lock);
     page_list_for_each_safe ( page, tmp, &balloon )
     {